package com.bruce;

import com.bruce.rpc.RpcFactory;
import com.bruce.service.UserService;
import org.apache.zookeeper.KeeperException;

import java.io.IOException;
import java.rmi.NotBoundException;

/**
 * @author Bruce
 */
public class TestRpcClient {
    public static void main(String[] args){
        //通过框架，连接zk，获取接口的动态代理对象
        try {
            UserService userService = RpcFactory.getServiceProxy(UserService.class);
            System.out.println(userService.getClass().getName());
            System.out.println(userService.getUser("陈子诺"));
        } catch (NotBoundException | IOException | InterruptedException | KeeperException e) {
            e.printStackTrace();
        }
    }
}
